package java2_unit7_1022;

import java.util.InputMismatchException;
import java.util.Scanner;

//求两个数的商
public class Test1 {

	public static void divide() {
		Scanner scanner = new Scanner(System.in);
		try {
			System.out.print("请输入被除数：");
			int a =scanner.nextInt();
			System.out.print("请输入除数：");
			int  b= scanner.nextInt();
			int c=a/b;
			System.out.println("商是："+c);
		} catch (ArithmeticException e) {
			System.err.println("除数不能是0！");
			e.printStackTrace();
			System.out.println(e.getMessage());
		}catch (InputMismatchException e) {
			System.err.println("除数必须是整数！");
			e.printStackTrace();
		}finally {
			System.out.println("运算结束！");
		}
	}
	
	
	public static void main(String[] args) {
		divide();
	}
}
